package com.seanLab.dao;

import com.seanLab.domain.Image;
import com.seanLab.domain.TagInfo;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

import java.util.*;

/**
 * Created by ailly on 17-8-27.
 */
@Repository
@Qualifier("fakeImage")
public class FakeImageDaoImpl implements ImageDao {
    private static Map<Integer, Image> images;

    static {
        images = new HashMap<Integer, Image>() {
            {
//                put(1, new Image("1", "http://images.sean.com/img001.jpg", "/storage/img001.jpg", "一幅图片", new int[]{123, 456}, null, new ArrayList<TagInfo>(Arrays.asList(new TagInfo("tag_0001", "复旦大学",  "article", 9.0), new TagInfo("tag_0002", "985",  "article", 7.5 ), new TagInfo("tag_0003", "上海", "article", 5.0) ) ) ) );

            }
        };
    }

    @Override
    public int insertImage(Image image) {
        this.images.put(Integer.parseInt(image.getImgID ()), image);
        return 0;
    }

    @Override
    public int insertImageCollection(List<Image> imageList) {
        for (Image i : imageList) {
            insertImage(i);
        }
        return 0;
    }

    @Override
    public int updateImageCollection(List<Image> imageList) {
        return 0;
    }

    @Override
    public int removeImageById(String id) {
        return 0;
    }

    @Override
    public int updateImageById(String id) {
        return 0;
    }

    @Override
    public Collection<Image> getAllImages() {
        return this.images.values();
    }

    @Override
    public Image getImageById(String id) {
        return null;
    }
}
